local Lua__wangdaozhengtu = fk.CreateSkill {

  name = "Lua__wangdaozhengtu",

  tags = { Skill.Compulsory },

}

Fk:loadTranslationTable{
    
    ["Lua__wangdaozhengtu"] = "王道征途",
    ["$Lua__wangdaozhengtu1"] = "果然还是王道征途，泡泡系吧。",
    [":Lua__wangdaozhengtu"] = "锁定技，游戏开始时，若你不是主公，你与主公交换身份；若你不是一号位，你与一号位交换座次。",
}

Lua__wangdaozhengtu:addEffect(fk.GameStart, {
    anim_type = "control",
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(Lua__wangdaozhengtu.name)
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        -- 交换身份
        if player.role ~= "lord" then
            local lord = room:getLord()
            if lord then
                player.role, lord.role = lord.role, player.role
                player.room:broadcastProperty(player, "role")
                player.room:broadcastProperty(target, "role")
            end
        end
        -- 交换座次
        if player.seat ~= 1 then
            local first_player = nil
            for _, p in ipairs(room:getAlivePlayers()) do
                if p.seat == 1 then
                    first_player = p
                    break
                end
            end
            if first_player then
                -- 交换座次
                local temp_seat = player.seat
                room:swapSeat(player, first_player)
            end
        end
    end,
})

return Lua__wangdaozhengtu